package com.kitty.game.fight.artifact.active;

import com.kitty.game.fight.bean.Fight;
import com.kitty.game.fight.bean.FightObject;
import com.kitty.game.fight.model.SkillAutoPicker;
import com.kitty.game.fight.artifact.active.RingSkillProcessor;
import com.kitty.game.fight.artifact.active.SneerSkillProcessor;

import java.util.HashMap;
import java.util.Map;

/**
 * 法宝特殊技能--主动技能
 */
public abstract class ArtifactSkillProcessor {

    private static Map<Integer, ArtifactSkillProcessor> processors = new HashMap<>();

    /** 嘲讽*/
    public static final int SNEER_SKILL = 475;
    /** 金刚圈*/
    public static final int RING_SKILL = 472;

    static {
        processors.put(RING_SKILL, new RingSkillProcessor());
        processors.put(SNEER_SKILL, new SneerSkillProcessor());
    }

    public SkillAutoPicker autoFightTarget(Fight fight, FightObject attacker, int skillId) {
        attacker.setTargetId(attacker.getId());
        return new SkillAutoPicker().setSkillId(skillId).setTargetId(attacker.getId());
    }

    public void useSkill(Fight fight, FightObject attacker, int specialSkillLevel) {
        if (!checkUseCondition(fight, attacker)) {
            return;
        }
        binging(fight, attacker,specialSkillLevel);
    }

    protected boolean checkUseCondition(Fight fight, FightObject attacker) {
        return true;
    }

    /**
     * 主动释放技能后的效果绑定
     * @param fight
     * @param attacker
     */
    public abstract void binging(Fight fight, FightObject attacker,int specialSkillLevel);

    /**
     * 技能效果延迟生效
     *
     * @param fight
     * @param attacker
     */
    public abstract Object delayAction(Fight fight, FightObject attacker, Object... params);

    public static ArtifactSkillProcessor getSkillProcessor(int skillId) {
        return processors.get(skillId);
    }
}

